package com.lcy.websocket;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.stream.Collectors;

public class TestLambda {

    public static void filter(List<String> testList){
        testList.add("yyf");
        testList.forEach(System.out::println);
    }

    public static void filter2(List<String> testList){
        testList = testList.stream().filter(path -> {
            if (!path.equals("zq")) {
                return true;
            } else {
                return false;
            }
        }).collect(Collectors.toList());
//        zq.forEach(System.out::println);
//        System.out.println("=====================");
        testList.forEach(System.out::println);
    }

    public static void main(String[] args) {
        List<String> testList = new ArrayList<>();
        testList.add("gcc");
        testList.add("gyy");
        testList.add("cwh");
        testList.add("zq");
//        filter(testList);
//        System.out.println("=========================");
//        testList.forEach(System.out::println);
        filter2(testList);
    }
}
